package cn.summit.config;

import cn.summit.serialization.service.AttUrlService;
import cn.summit.serialization.service.DictSerialService;
import cn.summit.serialization.utils.SeriUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自定义序列化配置
 *
 * @author summit
 * @since 2020/11/17 10:58
 */
@Configuration
@Slf4j
public class SerialConfig {

    @Bean
    public SeriUtils seriUtils() {
        return new SeriUtils();
    }

    @Bean
    @ConditionalOnMissingBean(AttUrlService.class)
    public AttUrlService attUrlService() {
        return (bizId) -> {
            log.warn("未实现AttUrlService接口");
            return null;
        };
    }

    @Bean
    @ConditionalOnMissingBean(DictSerialService.class)
    public DictSerialService dictSerialService() {
        return (parentCode, dictCode) -> {
            log.warn("未实现DictSerialService接口");
            return null;
        };
    }
}

